/**
 * webapi
 * @authors 杨兴洲（of2502）
 * @date    2017/5/25 0025 20:30
 * @version 1.0
 * @last-modify  杨兴洲（of2502）
 */

import QMFetch from 'fetch/index';

/**
 * 账户相关api
 */
const WebApi = {

    /**
     * 获取关注时回复
     */
    fetchFollowReply: () => QMFetch({
        url: 'api/message/reply/rule/follow',
        method: 'GET'
    }),

    /**
     * 更新关注回复规则
     */
    updateFollowReply: (rule) => QMFetch({
        url: `api/message/reply/rule/follow/update`,
        method: 'POST',
        body: rule
    }),

    deleteFollowReply: () => QMFetch({
        url: `api/message/reply/rule/follow/delete`,
        method: 'POST'
    }),

    /**
     * 获取关键词回复列表
     */
    fetchKeywordReplyList: (body) => QMFetch({
        url: `api/message/reply/rule/keyword/list`,
        method: 'GET',
        body
    }),

    /**
     * 创建关键词回复列表
     */
    createKeywordReply: (rule) => QMFetch({
        url: `api/message/reply/rule/keyword/create`,
        method: 'POST',
        body: {rule}
    }),

    /**
     * 更新关键词回复列表
     */
    updateKeywordReply: (body) => QMFetch({
        url: `api/message/reply/rule/keyword/update`,
        method: 'POST',
        body
    }),

    /**
     * 删除关键词回复列表
     */
    deleteKeywordReply: (ruleID) => QMFetch({
        url: `api/message/reply/rule/keyword/delete`,
        method: 'POST',
        body: {
            ruleID
        }
    }),

    /**
     * 获取图文详情
     */
    getMPNewsDetail: (media_id) => QMFetch({
        url: `api/material/${media_id}`,
        method: 'GET'
    }),

    getNewsDetail: (id) => QMFetch({
        url: `api/advancedNews/detail`,
        method: 'GET',
        body: {
            id
        }
    })
};
export default WebApi;